package com.fyl.log.anno;


import com.fyl.log.LogConfiguration;
import com.fyl.log.LogServiceRegistrar;
import com.fyl.log.service.AsyncLogService;
import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.Import;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AliasFor;
import org.springframework.scheduling.annotation.EnableAsync;

import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target(TYPE)
@Retention(RUNTIME)
@Import({LogServiceRegistrar.class, LogConfiguration.class})
@EnableAsync
public @interface EnableAsyncLog {

    Class<? extends AsyncLogService> value();

    @AliasFor(annotation = EnableAsync.class)
    Class<? extends Annotation> annotation() default Annotation.class;

    @AliasFor(annotation = EnableAsync.class)
    boolean proxyTargetClass() default false;

    @AliasFor(annotation = EnableAsync.class)
    AdviceMode mode() default AdviceMode.PROXY;

    @AliasFor(annotation = EnableAsync.class)
    int order() default Ordered.LOWEST_PRECEDENCE;
}
